import axios from "axios"; // 引入axios
import qs from "qs";

// 创建一个axios实例
const request = new axios.create({
  baseURL: "https://m.maizuo.com", // 基础url
  timeout: 5000, // 超时时间
});

// 接口
const getInterface = (params, path) =>
  request.get("/gateway", {
    params,
    headers: {
      "x-host": "mall.film-ticket." + path,
      "x-client-info":
        '{ "a": "3000", "ch": "1002", "v": "5.2.1", "e": "174057150511175504904193", "bc": "110100" }',
    },
  });

export const postInterface = (params, path) =>
  request.post("/gateway", params, {
    headers: {
      "x-host": "mall.film-ticket." + path,
      "x-client-info":
        '{ "a": "3000", "ch": "1002", "v": "5.2.1", "e": "174057150511175504904193", "bc": "110100" }',
    },
  });

// export const getdownload = () => {
//   const form = new FormData();
//   form.append(
//     "params",
//     "z0oinTxyyKX+FJcNwxDGKcNcoNyJLD3elCBDjwWP/VGM/WpoJx3b4ldJIkiVThX07UwutELiozeI2o0UQtMcDDF/+6p4aKnAx/PHO24RlC52HcmPI8I79tuLDRbtmnNkBUa06+WcD9jSFR1dgfeKng=="
//   );
//   form.append(
//     "encSecKey",
//     "b27defdeaea76694828f0bbe791a673b90f23d5e75759dfadb7a3ac004cdbf39f0f9316a8129b080ca63939b5f34e3ecb44ad0dca4fc0a5d1985eada355862b5e915aaa1dee6bfae5927629368b6def80837ecc9e440106811ad46e58a03c810c152f428f6a6e2100783c3db9a5409c14bf833ef30d17e29977f86648526a1b4"
//   );
//   return axios.post("/api/get", form, {
//     params: {
//       csrf_token: "cf9dd9ca4c4410417fd629271ffa6dea",
//     },
//     headers: {
//       "content-type": "application/x-www-form-urlencoded",
//     },
//   });
// };

export default getInterface;
